<?php
declare(strict_types=1);
namespace App\Controller\Notify;

use App\Controller\AbstractController;
use Hyperf\HttpServer\Contract\RequestInterface;
use Hyperf\HttpServer\Contract\ResponseInterface;
use Hyperf\HttpServer\Annotation\RequestMapping;
use Hyperf\HttpServer\Annotation\Controller;
use Service\PayService\Payer\Hnapay;
use Service\PayService\Payer\Helipay;
use Hyperf\Di\Annotation\Inject;

/**
 * 收银支付接口回调
 * 
 * @Controller(prefix="/cashpay/notify")
 */
class CashPayController extends AbstractController
{
    /**
     * @Inject()
     * @var Hnapay
     */
    protected $hnapy;
    
    /**
     * 回调接口地址
     * @RequestMapping(path="hnapay/{order_id}", methods="post")
     */
    public function hnapaynotify(RequestInterface $request,ResponseInterface $response,$order_id)
    {
        $data=$request->getParsedBody();
        $this->hnapy->cashNotify($data['msg']);
        return $response->raw('success');
    }
    /**
     * @Inject()
     * @var Helipay
     */
    protected $helipay;
    
    /**
     * 回调接口地址
     * @RequestMapping(path="helipay/{order_id}", methods="post")
     */
    public function helipaynotify(RequestInterface $request,ResponseInterface $response,$order_id)
    {
        $data=$request->getParsedBody();
        $this->helipay->cashNotify($data);
        return $response->raw('success');
    }
}
